package com.peter.recyclerviewdemo;

import android.graphics.drawable.Drawable;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;

public class ImageViewHolder extends RecyclerView.ViewHolder {
    public ImageView mImageView;
    private TextView mTop;
    private TextView mBottom;

    public ImageViewHolder(@NonNull View itemView) {
        super(itemView);
        mImageView = (ImageView) itemView.findViewById(R.id.image);
        mTop = itemView.findViewById(R.id.top);
        mBottom = itemView.findViewById(R.id.bottom);
        mTop.setVisibility(View.VISIBLE);
    }

    public void bindImage(Drawable drawable) {
        mImageView.setImageDrawable(drawable);
    }

    public void setText(String str) {
        mTop.setText(str);
    }

    public void setLayoutId(int id) {
        mTop.setText("" + id);
    }

    public void setRawId(int id) {
        mBottom.setText("" + id);
    }
}